﻿//////////////////////////////////////////////////////////////////
//
// SystemDiagnostics.cs
//
// Copyright (c) 2012 Dan Pike. All rights reserved
//
// Refer to license.txt for any license restrictions.
// 
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using log4net;

namespace Logger4Net.Appender
{
   public class SystemDiagnostics : log4net.Appender.AppenderSkeleton
   {
      protected override void Append(log4net.Core.LoggingEvent loggingEvent)
      {
         try
         {
            Debug.Write(RenderLoggingEvent(loggingEvent));
            if (immediateFlush_)
            {
               Debug.Flush();
            }
         }
         catch { }
      }

      public bool immediateFlush { get { return immediateFlush_; } set { immediateFlush_ = value; } }
      bool immediateFlush_ = true;
   }
}
